package io.gitee.yiwyn;


import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class Main {
    public static void main(String[] args) throws InterruptedException {

        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 2, TimeUnit.MINUTES, new ArrayBlockingQueue<>(10));

        CountDownLatch countDownLatch = new CountDownLatch(2);

        for (int i = 0; i < 10; i++) {
            threadPoolExecutor.submit(() -> {
                System.out.println("执行了线程里面的事件");
            });
        }

//        countDownLatch.await();

        System.out.println("都执行完成了");


    }
}